import PatientList from '@/components/PatientList';
import { AndroidOutlined, AppleOutlined } from '@ant-design/icons';
import { ProTable } from '@ant-design/pro-components';
import { Card, Col, Drawer, List, Modal, Row, Tabs, Typography, message } from 'antd';
import React, { useState, useEffect } from 'react';
import { useHistory, useParams } from 'umi';

import styles from './index.module.less'

const Patient: React.FC = ({ gotoDetail, param, status, type, data }) => {


  const [inquirying, setInquirying] = useState<boolean>(false);

  const textArr = ["门诊", "复诊开方"];

  const history = useHistory();
  const params = useParams();

  const [isDetail, setIsDetail] = useState<boolean>(false);

  // const data = [
  //     {
  //       title: 'Title 1',
  //     },
  //     {
  //       title: 'Title 2',
  //     },
  //     {
  //       title: 'Title 3',
  //     },
  //     {
  //       title: 'Title 4',
  //     },];

  async function onSelectList(item: any) {
    // setLoading(true)
    // await getDetal(item?.id)
    // setUser(item)
    // setLoading(false)
    // setInquirying(true);
    // history.push('/inquiry/'+item?.id);

    console.log(item?.id)
    setIsDetail(true);
    gotoDetail(item);
  }

  useEffect(() => {
  }, []);


  return (
    <>
      {isDetail ?
        <>
          <Typography.Text>Loading...</Typography.Text>
        </>
        :
        <div className={styles.patientList}>
          <p style={{ borderLeft: '3px solid red', paddingLeft: 10 }}>{data == 1 ? '待就诊' : '待复诊'}</p>
          <PatientList
            status={status}
            type={type}
            update={''}
            searchKey={''}
            onSelect={(item: any) => onSelectList(item)} onPush={undefined} user={undefined} datatype={data} />
          {
            data == 1 && <><p style={{ borderLeft: '3px solid red', paddingLeft: 10 }}>已完成</p>
              <PatientList
                status={3}
                type={type}
                update={''}
                searchKey={''}
                onSelect={(item: any) => onSelectList(item)} onPush={undefined} user={undefined} datatype={3} />
            </>
          }
        </div>
      }
    </>
  )
};
export default Patient;